﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DirSyncTests
{
    [TestClass]
    public class DotNetSanityChecks
    {
        [TestMethod]
        public void DotNetSC_FileAttributesAreNotCopiedFromCopySource()
        {
            DirSyncUnitTest.DeleteTestDirsAndFiles();
            DirSyncUnitTest.CreateInitialTestDirs();
            DirSyncUnitTest.CreateInitialTestFiles();
            DirSyncUnitTest.ModifyFileAttributes(Path.Combine(DirSyncUnitTest.sourcedir, DirSyncUnitTest.fileonename));
            //non-archive/normal does not copy with this copy operation
            File.Copy(Path.Combine(DirSyncUnitTest.sourcedir, DirSyncUnitTest.fileonename),
            Path.Combine(DirSyncUnitTest.targetdir, DirSyncUnitTest.fileonename)); 
            FileInfo sourcefi = new FileInfo(Path.Combine(DirSyncUnitTest.sourcedir, DirSyncUnitTest.fileonename));
            FileInfo targetfi = new FileInfo(Path.Combine(DirSyncUnitTest.targetdir, DirSyncUnitTest.fileonename));
            Assert.AreNotEqual(sourcefi.Attributes, targetfi.Attributes);
        }

        [TestMethod]
        public void DotNetSC_GenericListsAllowMultipleCopiesOfAValue()
        {
            List<string> testlist = new List<string>();
            testlist.Add("one");
            testlist.Add("two");
            testlist.Add("two");
            Assert.AreEqual(3, testlist.Count);
        }
    }
}
